package com.mer.statistic.service;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.mer.statistic.entity.Course;
import com.mer.statistic.mapper.CourseMapper;
import com.mer.statistic.utils.Result;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @program: iiphase-project-master
 * @description:
 * @author: 薛宁宁
 * @create: 2021-10-18 22:05
 **/
@Service
public class CourseImpl implements CourseService{
    @Resource
    private CourseMapper courseMapper;
    @Override
    public Result queryByCourseRanking(Course course) {
        QueryWrapper<Course> wrapper = new QueryWrapper<>();
        if (StringUtils.isNotEmpty(course.getGmtCreate())){
            wrapper.ge("gmt_modified",course.getGmtCreate());
        }
        if (StringUtils.isNotEmpty(course.getGmtModified())){
            wrapper.le("gmt_modified",course.getGmtModified());
        }

        List<Map> maps = courseMapper.queryByCourseRanking(course);
        return new Result(2000,"查询成功",maps);
    }
}
